<?php

namespace Yolo\Components\Cache;

/**
 * Cache interface.
 */
interface CacheInterface
{
    /**
     * Get a value from the cache.
     * @param string $key
     * @return mixed
     */
    public function get(string $key): mixed;

    /**
     * Set a value in the cache.
     * @param string $key
     * @param mixed $value
     * @param int $expireIn
     * @return void
     */
    public function set(string $key, mixed $value, int $expireIn = 3600): void;

    /**
     * Delete a value from the cache.
     * @param string $key
     * @return int|bool
     */
    public function delete(string $key): int | false;

    /**
     * Clear the cache.
     * @return void
     */
    public function clear(): void;

    /**
     * Check if a key exists in the cache.
     * @param string $key
     * @return bool
     */
    public function exists(string $key): bool;
}
